package com.example.testenum;

/**
 * Created by admin on 2018/6/5.
 *
 * 有时候，我们可能需要对一组数据进行分类，比如进行食物菜单分类，而且希望这些菜单都属于food类型
 * appetizer(开胃菜)、mainCourse(主菜)、dessert(点心)、Coffee(咖啡)，每种分类下有多种菜式或
 * 食品，此时可以使用接口来组织，代码如下：
 */
public interface FoodEnum {

    enum Appetizer implements FoodEnum{
        SALAD,SOUP,SPRING_ROLLS;
    }

    enum MainCourse implements FoodEnum {
        LASAGNE, BURRITO, PAD_THAI,
        LENTILS, HUMMOUS, VINDALOO;
    }

    enum Dessert implements FoodEnum {
        TIRAMISU, GELATO, BLACK_FOREST_CAKE,
        FRUIT, CREME_CARAMEL;
    }

    enum Coffee implements FoodEnum {
        BLACK_COFFEE, DECAF_COFFEE, ESPRESSO,
        LATTE, CAPPUCCINO, TEA, HERB_TEA;
    }

    public static void main(String[] args) {
        FoodEnum food = FoodEnum.Appetizer.SALAD;
        int food2 = FoodEnum.MainCourse.VINDALOO.ordinal();

        System.out.println("==>"+food.toString());
        System.out.println("==>"+food2);
    }
}
